#include "VisualStimulus.h"
#include "GraphObject.h"

using namespace std;
using namespace GUI;

VisualStimulus::VisualStimulus()
	:mPresentationMode(ShowHide),
	 mDimFactor(0.5),
	 mBeginPresented(false)
{
}

VisualStimulus::~VisualStimulus()
{
}

VisualStimulus& VisualStimulus::SetPresentationMode(Mode m)
{
	mPresentationMode = m;
	GraphObject* pobj = dynamic_cast<GraphObject*>(this);
	if(pobj)
		pobj->Change();
	return *this;
}

VisualStimulus::Mode VisualStimulus::PresentationMode() const
{
	return mPresentationMode;
}

VisualStimulus& VisualStimulus::SetDimFactor(float df)
{
	mDimFactor = df;
	GraphObject* pobj = dynamic_cast<GraphObject*>(this);
	if(pobj)
		pobj->Change();

	return *this;
}

float VisualStimulus::DimFactor() const
{
	return mDimFactor;
}

void VisualStimulus::OnPresent()
{
	mBeingPresented = true;
	GraphObject* pobj = dynamic_cast<GraphObject*>(this);
	if(pobj)
		pobj->Invalidate();
}

void VisualStimulus::OnConceal()
{
	mBeingPresented = false;
	GraphObject* pobj = dynamic_cast<GraphObject*>(this);
	if(pobj)
		pobj->Invalidate();
}

bool VisualStimulus::BeingPresented() const
{
	return mBeingPresented;
}